package com.appliance.cycling2011;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;

public class RootActivity extends Activity {

	// Used for wallpapers
	static int currentImageResId = 0;
	static int currentImageIndex = -1;

	public final static String directory = "/cyc2011/";
	public final static String PATH_DIR = Environment.getExternalStorageDirectory() + directory;

	// rss from UCI
	final static String rssUciNews = "http://www.uci.ch/rss/RSS_allnews.xml";
	public final static String rssUciNewsFilename = "cycrss";

	// html news from VM cycling
	final static String htmlVmNewsLink = "http://www.copenhagen2011.dk/m/index.php";
	public final static String htmlVmNewsFilename = "cycrss1";
	public final static String htmlVmNewsExtension = "html";	
	public final static String htmlVmNewsFilePath = PATH_DIR + htmlVmNewsFilename + "." + htmlVmNewsExtension;	
	public final static String htmlscheduleFilePath = PATH_DIR + "schedule" + "." + htmlVmNewsExtension;	

	public static String getRss(int i) {
		switch (i) {
		case 0:
		default:
			return rssUciNews;
		case 1:
			return htmlVmNewsLink;
		}
	}

	public static int getRssNumber(String url) {
		for (int i = 0; i < getDownloadLength(); i++) {
			if (url.equals(getRss(i))) {
				return i;
			}
		}
		return 0;
	}

	public static int getDownloadLength() {
		return 1;
	}

	public Bitmap getImage() {
		return BitmapFactory.decodeResource(getResources(), R.drawable.bg);
	}
}
